A typical computer system runs many processes. One process run by certain computer systems is known as Garbage Collection (GC). Garbage Collection is the process of automatically freeing objects that are no longer referenced by the program. This frees the programmer from having to keep track of when to free allocated memory, thereby preventing many potential bugs and headaches. When an object is no longer referenced by a program, the heap space it occupies is recycled so that the space is available for subsequent new objects. The Garbage Collector must determine which objects are no longer referenced by the program and make available the heap space occupied by such unreferenced objects. In the process of freeing unreferenced objects, the Garbage Collector must run any finalizers of objects being freed. In addition to freeing unreferenced objects, a Garbage Collector may also combat heap fragmentation. Heap fragmentation occurs through the course of normal program execution. New objects are allocated, and unreferenced objects are freed such that free blocks of heap memory are left in between blocks occupied by live objects. Requests to allocate new objects may have to be fulfilled by extending the size of the heap even though there is enough total unused space in the existing heap. This will happen if there is not enough contiguous free heap space available into which the new object will fit. On a virtual memory system, the extra paging required to service an ever-growing heap could degrade the performance of the executing program.
A Garbage Collector performs several tasks. First, the GC must detect garbage objects. Second, the GC must reclaim the heap space used by the garbage objects and make this space available to the program. Garbage detection is ordinarily accomplished by defining a set of roots and determining reachability from the roots. An object is reachable if there is some path of references from the roots by which the executing program can access the object. The roots are accessible to the program. Any objects that are reachable from the roots are considered live. Objects that are not reachable are considered garbage, because they can no longer affect the future course of program execution.
When the Garbage Collector starts running it assumes that all the objects in the heap are garbage. The Garbage Collector starts walking the roots and building a graph of all objects reachable from the roots. Once all the roots have been checked, the Garbage Collector's graph contains the set of all objects that are somehow reachable from the application's roots. Any objects that are not in the graph are not accessible by the application, and are therefore considered garbage. The Garbage Collector walks through the heap linearly, looking for contiguous blocks of garbage objects. The Garbage Collector then copies the non-garbage objects down in memory removing all of the gaps in the heap. Moving the objects in memory invalidates all pointers to the objects. Therefore the Garbage Collector modifies the application's roots so that the pointers point to the objects' new locations. In addition, if any object contains a pointer to another object, the Garbage Collector is responsible for correcting these intra-heap pointers as well. Finally the pointer is positioned just after the last non-garbage object.
Another process that may be run by computer systems is reference counting. Reference counting is a technique of storing the number of references, pointers, or handles to a resource such as an object or block of memory. It is typically used as a means of deallocating objects which are no longer referenced. Reference counting is often known as a garbage collection algorithm where each object contains a count of the number of references to it held by other objects. If an object's reference count reaches zero, the object has become inaccessible, and it is put on a list of objects to be destroyed.
Simple reference counts require frequent updates. Whenever a reference is destroyed or overwritten, the reference count of the object it references is decremented, and whenever one is created or copied, the reference count of the object it references is incremented.
One of the advantages of reference counting is that objects are reclaimed as soon as they can no longer be referenced, and in an incremental fashion, without long pauses for collection cycles and with clearly defined lifetime of every object. In real-time applications or systems with limited memory, this is important to maintain responsiveness. Reference counting is also among the simplest forms of garbage collection to implement. It also allows for effective management of non-memory resources such as operating system objects, which are often much scarcer than memory.
In information technology, the term “backup” refers to making copies of data so that these additional copies may be used to restore the original data after a data loss event. These additional copies are typically called “backups.” Backups are useful primarily for two purposes. The first is to restore a state following a disaster (called disaster recovery). The second is to restore small numbers of files after they have been accidentally deleted or corrupted.
Since a backup system contains at least one copy of all data worth saving, the data storage requirements are considerable. Organizing this storage space and managing the backup process is a complicated undertaking. A data repository model can be used to provide structure to the storage. In the modern era of computing there are many different types of data storage devices that are useful for making backups. There are also many different ways in which these devices can be arranged to provide redundancy, data security, and portability.